#include <iostream>

int main() {
    void inv(int * x, int n);
    int i, a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    printf("The original array: \n");
    for (i = 0; i < 10; i++) {
        printf("%d ", a[i]);
    }
    printf("\n");
    inv(a, 10);
    printf("The array has benn inverted:\n");
    for (i = 0; i < 10; i++) {
        printf("%d ", a[i]);
    }
    return 0;
}


void inv(int *a, int n) {
    int *i = a, *j = a + n - 1, temp, m;
    m = (n - 1) / 2;
    for (; i <= a + m; i++, j--) {
        temp = *i; *i = *j; *j = temp;
    }
}
